package com.hospital.data.simulation.controller;

import com.hospital.common.base.Result;
import com.hospital.common.pojo.TDiagnosis;
import com.hospital.data.simulation.service.TDiagnosisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 检查管理接口
 * @author yhn
 * @version 1.0
 */
@RestController
@RequestMapping("/diagnosis")
public class DiagnosisController {
    @Autowired
    private TDiagnosisService diagnosisService;

    /**
     * 添加检查
     * @param diagnosis 检查表
     * @return 添加的检查ID
     */
    @PostMapping("/add")
    public Result<Long> addDiagnosis(@RequestBody TDiagnosis diagnosis){
        return Result.success(diagnosisService.addDiagnosis(diagnosis));
    }

    /**
     * 更改检查
     */
    @PostMapping("/update")
    public Result<?> updateDiagnosis(@RequestBody TDiagnosis diagnosis){
        diagnosisService.updateDiagnosis(diagnosis);
        return Result.success();
    }
}
